WPS Office.apk(点击下载) / zii.java


package defpackage;

import android.support.v4.os.EnvironmentCompat;
import com.appsflyer.AppsFlyerProperties;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.hp.hpl.inkml.Canvas;
import com.hp.hpl.inkml.CanvasTransform;
import com.hp.hpl.inkml.IBrush;
import com.hp.hpl.inkml.InkSource;
import com.hp.hpl.inkml.Timestamp;
import com.hp.hpl.inkml.TraceFormat;
import com.mopub.mobileads.VastExtensionXmlManager;
import com.mopub.mobileads.VastIconXmlManager;
import defpackage.zig;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.paho.client.mqttv3.MqttTopic;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

/* renamed from: zii  reason: default package */
public final class zii implements ErrorHandler, zim {
    private static final String TAG = null;
    private Document AXI;
    private zin AXJ;

    public zii(zin zin) {
        this.AXJ = zin;
    }

    private static InkSource.a a(Element element, InkSource inkSource) throws zik {
        inkSource.getClass();
        InkSource.a aVar = new InkSource.a();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Node item = attributes.item(i);
            String localName = item.getLocalName();
            if ("size".equals(localName)) {
                aVar.gDg = item.getNodeValue();
            }
            if (VastIconXmlManager.HEIGHT.equals(localName)) {
                aVar.AYb = new Double(item.getNodeValue()).doubleValue();
            }
            if (VastIconXmlManager.WIDTH.equals(localName)) {
                aVar.AYc = new Double(item.getNodeValue()).doubleValue();
            }
            if ("units".equals(localName)) {
                aVar.AWQ = item.getNodeValue();
            }
        }
        return aVar;
    }

    private static zhv a(Element element) throws zik {
        zhv zhv = new zhv();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Attr attr = (Attr) attributes.item(i);
            String name = attr.getName();
            if (VastExtensionXmlManager.TYPE.equals(name)) {
                zhv.type = attr.getValue();
            } else if ("encoding".equals(name)) {
                zhv.aSR = attr.getValue();
            } else if ("href".equals(name)) {
                String value = attr.getValue();
                try {
                    new zix(value);
                    zhv.gLV();
                    if (!"".equals(value)) {
                        try {
                            HashMap<String, String> hashMap = zhv.AWK;
                            throw new zik("Feature (AnnotationXML:getPropertyElementsMapFromHrefElement) is not implimented.");
                        } catch (zik e) {
                            e.getMessage();
                        }
                    } else {
                        continue;
                    }
                } catch (zik e2) {
                    throw new zik("Problem in binding 'href' attribute of AnnotationXML data.\nReason: " + e2.getMessage());
                }
            } else {
                zhv.AWI.put(name, attr.getValue());
            }
        }
        new StringBuilder("annotationXML received: ").append(element.toString());
        NodeList childNodes = element.getChildNodes();
        int length2 = childNodes.getLength();
        if (length2 > 0) {
            for (int i2 = 0; i2 < length2; i2++) {
                Node item = childNodes.item(i2);
                if (item instanceof Element) {
                    Element element2 = (Element) item;
                    String localName = element2.getLocalName();
                    zhv.AWK.put(localName, element2.getFirstChild().getNodeValue());
                    new StringBuilder("The property with name = ").append(localName).append(" is added to the propertyElementsMap.");
                }
            }
        }
        return zhv;
    }

    private ziw a(Element element, zif zif) throws zik {
        zit zit;
        zic zic;
        zit zit2 = null;
        ziw ziw = new ziw();
        String h = h(element);
        if (!"".equals(h)) {
            ziw.id = h;
        }
        String attribute = element.getAttribute("contextRef");
        if (!"".equals(attribute)) {
            ziw.AYQ = attribute;
        }
        if (zif != null && !"".equals(ziw.AYQ)) {
            try {
                zic = zif.aeI(ziw.AYQ);
            } catch (zik e) {
                new StringBuilder("Error in TraceView::resolveContext.\nMessage: ").append(e.getMessage());
                zic = null;
            }
            if (zic != null) {
                ziw.a(zic);
                if (ziw.AYW == null) {
                    throw new zik("TraceView.resolveContext() failed. Reason, there is no selected sub-tree exist");
                }
                ziw.AYW.a(ziw.AYs);
            }
        }
        String attribute2 = element.getAttribute("traceDataRef");
        if (!"".equals(attribute2)) {
            ziw.AYT = attribute2;
            ziw.gHZ = element.getAttribute("from");
            ziw.AYU = element.getAttribute("to");
            if (zif != null) {
                String str = ziw.AYT;
                zih aeH = zif.aeH(str);
                if ("Trace".equals(aeH.gMa())) {
                    zit = (zis) aeH;
                } else if ("TraceGroup".equals(aeH.gMa())) {
                    zit = (ziv) aeH;
                } else if ("TraceView".equals(aeH.gMa())) {
                    zit = (ziw) aeH;
                } else {
                    throw new zik("The given Reference attribute value, " + str + "is not the 'id' of a Trace Data Element");
                }
                new StringBuilder("The reffered traceData: ").append(zit.gMa()).append(" - ").append(zit.getId());
                new StringBuilder("Select from:").append(ziw.gHZ).append(", to:").append(ziw.AYU);
                zit2 = zit.ig(ziw.gHZ, ziw.AYU);
            }
            ziw.AYW = zit2;
        } else {
            NodeList elementsByTagNameNS = element.getElementsByTagNameNS(element.getNamespaceURI(), "traceView");
            int length = elementsByTagNameNS.getLength();
            if (length != 0) {
                ziw.AYV = new ArrayList<>();
                for (int i = 0; i < length; i++) {
                    ziw.AYV.add(a((Element) elementsByTagNameNS.item(i), zif));
                }
                ziw.b(zif);
            }
        }
        return ziw;
    }

    private static void a(String str, SAXParseException sAXParseException) {
        System.err.print("[");
        System.err.print(str);
        System.err.print("] ");
        String systemId = sAXParseException.getSystemId();
        if (systemId != null) {
            int lastIndexOf = systemId.lastIndexOf(47);
            if (lastIndexOf != -1) {
                systemId = systemId.substring(lastIndexOf + 1);
            }
            System.err.print(systemId);
        }
        System.err.print(':');
        System.err.print(sAXParseException.getLineNumber());
        System.err.print(':');
        System.err.print(sAXParseException.getColumnNumber());
        System.err.print(": ");
        System.err.print(sAXParseException.getMessage());
        System.err.println();
        System.err.flush();
    }

    private void a(Element element, zig zig) throws zik {
        zih zih;
        int i = 0;
        String localName = element.getLocalName();
        if (localName.equals("definitions")) {
            zif zif = zig.AXs;
            NodeList childNodes = element.getChildNodes();
            while (i < childNodes.getLength()) {
                Node item = childNodes.item(i);
                if (item instanceof Element) {
                    Element element2 = (Element) item;
                    String localName2 = element2.getLocalName();
                    if (!"".equals(h(element2)) || !"".equals(element2.getAttribute("xml:id"))) {
                        if ("brush".equalsIgnoreCase(localName2)) {
                            zih = g(element2);
                        } else if ("traceFormat".equalsIgnoreCase(localName2)) {
                            zih = f(element2, zif);
                        } else if ("context".equalsIgnoreCase(localName2)) {
                            zic e = e(element2, zif);
                            zic gMw = zic.gMw();
                            if (e.AXk == null) {
                                e.AXk = gMw.AXk;
                            }
                            if (e.AWW == null) {
                                e.AWW = gMw.gMx();
                            }
                            if (e.AXl == null) {
                                e.AXl = gMw.AXl;
                            }
                            if (e.AXm == null) {
                                e.AXm = gMw.AXm;
                            }
                            if (e.AXn == null) {
                                e.AXn = gMw.AXn;
                            }
                            Timestamp timestamp = e.AXo;
                            zih = e;
                            if (timestamp == null) {
                                e.AXo = gMw.AXo;
                                zih = e;
                            }
                        } else if ("inkSource".equalsIgnoreCase(localName2)) {
                            zih = d(element2, zif);
                        } else if ("trace".equalsIgnoreCase(localName2)) {
                            zih = c(element2);
                        } else if ("traceGroup".equalsIgnoreCase(localName2)) {
                            zih = b(element2, zif);
                        } else if ("traceView".equalsIgnoreCase(localName2)) {
                            zih = a(element2, zif);
                        } else if ("canvas".equalsIgnoreCase(localName2)) {
                            zih = c(element2, zif);
                        } else if ("canvasTransform".equalsIgnoreCase(localName2)) {
                            zih = e(element2);
                        } else if ("timestamp".equalsIgnoreCase(localName2)) {
                            zih = gMI();
                        } else if ("mapping".equalsIgnoreCase(localName2)) {
                            zih = d(element2);
                        } else {
                            throw new zik("Parse Error: The element " + localName2 + "should not be a child to <definitions> element.\n");
                        }
                        zif.a(zih);
                    } else {
                        throw new zik("Elements within a <definitions> block must have an 'id' attribute. A " + localName2 + " element do not have 'id' attribute.");
                    }
                }
                i++;
            }
        } else if (localName.equals("context")) {
            zif zif2 = zig.AXs;
            zic e2 = e(element, zif2);
            if ("".equals(e2.gMy())) {
                e2.AWU.put("contextRef", MqttTopic.MULTI_LEVEL_WILDCARD + zig.AXt.getId());
            }
            e2.a(zig.AXs, zig.AXt);
            ArrayList<zig.a> arrayList = new ArrayList<>();
            if (e2 != null) {
                IBrush iBrush = e2.AXk;
                TraceFormat gMx = e2.gMx();
                InkSource inkSource = e2.AXl;
                Canvas canvas = e2.AXm;
                CanvasTransform canvasTransform = e2.AXn;
                Timestamp timestamp2 = e2.AXo;
                if (iBrush != null && !zig.AXt.AXk.equals(iBrush)) {
                    arrayList.add(zig.a.isBrushChanged);
                }
                if (gMx != null && !zig.AXt.gMx().b(gMx)) {
                    arrayList.add(zig.a.isTraceFormatChanged);
                }
                if (inkSource != null && !InkSource.b(inkSource)) {
                    arrayList.add(zig.a.isInkSourceChanged);
                }
                if (canvas != null) {
                    if (!(canvas == null ? false : zig.AXt.AXm.AWW.b(canvas.AWW))) {
                        arrayList.add(zig.a.isCanvasChanged);
                    }
                }
                if (canvasTransform != null && !zig.AXt.AXn.a(canvasTransform)) {
                    arrayList.add(zig.a.isCanvasTransformChanged);
                }
                if (timestamp2 != null && !zig.AXt.AXo.equals(timestamp2)) {
                    arrayList.add(zig.a.isTimestampChanged);
                }
            }
            if (arrayList.size() != 0) {
                if ("".equals(e2.getId())) {
                    String gMJ = zil.gMJ();
                    while (true) {
                        if (!(zif2.AXp.keySet().contains(gMJ) || zif2.AXq.keySet().contains(gMJ))) {
                            break;
                        }
                        gMJ = zil.gMJ();
                    }
                    e2.setId(gMJ);
                }
                zif2.a(e2);
                this.AXJ.a(e2, arrayList);
                zig.AXt = e2;
            }
        } else if (localName.equals("trace")) {
            zis c = c(element);
            zig.a(c);
            zin zin = this.AXJ;
            if (zin.AXR.size() != 0) {
                zin.AXR.toArray(new zij[zin.AXR.size()]);
            }
            if (!"".equals(c.getId())) {
                zig.AXs.b(c);
            }
        } else if (localName.equals("traceGroup")) {
            ziv b = b(element, zig.AXs);
            b.b(zig.AXt, zig.AXs);
            zig.a(b);
            zin zin2 = this.AXJ;
            if (zin2.AXR.size() != 0) {
                zin2.AXR.toArray(new zij[zin2.AXR.size()]);
            }
            if (!"".equals(b.getId())) {
                zig.AXs.b(b);
            }
            ArrayList<zit> arrayList2 = b.AYR;
            if (arrayList2 != null) {
                while (i < arrayList2.size()) {
                    zit zit = arrayList2.get(i);
                    if (!"".equals(zit.getId())) {
                        zig.AXs.b(zit);
                    }
                    i++;
                }
            }
        } else if (localName.equals("traceView")) {
            ziw a = a(element, zig.AXs);
            a.a(zig.AXt);
            zig.a(a);
            zin zin3 = this.AXJ;
            if (zin3.AXR.size() != 0) {
                zin3.AXR.toArray(new zij[zin3.AXR.size()]);
            }
            if (!"".equals(a.getId())) {
                zig.AXs.a(a);
            }
        } else if (localName.equals("annotation")) {
            zig.AWO = b(element);
        } else if (localName.equals("annotationXML")) {
            zig.AWN = a(element);
        } else {
            throw new zik("The Element " + localName + " is not a valid Child Element for InkML <Ink> Element");
        }
    }

    private Document aeM(String str) {
        File file = new File(str);
        DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
        newInstance.setNamespaceAware(true);
        try {
            DocumentBuilder newDocumentBuilder = newInstance.newDocumentBuilder();
            newDocumentBuilder.setErrorHandler(this);
            return newDocumentBuilder.parse(file);
        } catch (IOException | ParserConfigurationException | SAXException e) {
            return null;
        }
    }

    private static zht b(Element element) throws zik {
        zht zht = new zht();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Attr attr = (Attr) attributes.item(i);
            String name = attr.getName();
            if (VastExtensionXmlManager.TYPE.equals(name)) {
                zht.type = attr.getValue();
            } else if ("encoding".equals(name)) {
                zht.aSR = attr.getValue();
            } else {
                zht.AWI.put(name, attr.getValue());
            }
        }
        Node firstChild = element.getFirstChild();
        if (firstChild != null) {
            zht.AWJ = firstChild.getNodeValue();
        }
        return zht;
    }

    private ziv b(Element element, zif zif) throws zik {
        ziv ziv = new ziv();
        String h = h(element);
        String attribute = element.getAttribute("contextRef");
        String attribute2 = element.getAttribute("brushRef");
        if (!"".equals(h)) {
            ziv.id = h;
        }
        if (!"".equals(attribute)) {
            ziv.AYQ = attribute;
        }
        if (!"".equals(attribute2)) {
            ziv.AWM = attribute2;
        }
        NodeList childNodes = element.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item instanceof Element) {
                Element element2 = (Element) item;
                String localName = element2.getLocalName();
                if ("trace".equals(localName)) {
                    zis c = c(element2);
                    c.AYt = ziv;
                    ziv.b(c);
                } else if ("traceGroup".equals(localName)) {
                    ziv b = b(element2, zif);
                    b.AYt = ziv;
                    ziv.b(b);
                } else if ("traceView".equals(localName)) {
                    ziw a = a(element2, zif);
                    a.AYt = ziv;
                    ziv.b(a);
                } else if ("annotation".equals(localName)) {
                    ziv.a(b(element));
                } else if ("annotationXML".equals(localName)) {
                    ziv.a(a(element));
                }
            }
        }
        ziv.b(this.AXJ.khB.AXt, zif);
        return ziv;
    }

    private Canvas c(Element element, zif zif) throws zik {
        Canvas canvas = new Canvas();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Node item = attributes.item(i);
            String localName = item.getLocalName();
            String nodeValue = item.getNodeValue();
            if (canvas.AWU == null) {
                canvas.AWU = new HashMap<>();
            }
            canvas.AWU.put(localName, nodeValue);
        }
        NodeList elementsByTagNameNS = element.getElementsByTagNameNS(element.getNamespaceURI(), "traceFormat");
        if (elementsByTagNameNS.getLength() != 0) {
            canvas.AWW = f((Element) elementsByTagNameNS.item(0), zif);
        }
        return canvas;
    }

    private zis c(Element element) throws zik {
        zis zis = new zis();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Node item = attributes.item(i);
            zis.setAttribute(item.getLocalName(), item.getNodeValue());
        }
        String str = "";
        NodeList childNodes = element.getChildNodes();
        for (int i2 = 0; i2 < childNodes.getLength(); i2++) {
            if (childNodes.item(i2).getNodeType() == 3) {
                str = str + childNodes.item(i2).getNodeValue();
            }
        }
        zig zig = this.AXJ.khB;
        zic zic = zig.AXt;
        zif zif = zig.AXs;
        zis.a(zic, zif);
        zis.a(str, zic, zif);
        return zis;
    }

    private InkSource d(Element element, zif zif) throws zik {
        InkSource.d dVar;
        InkSource.b bVar;
        InkSource.c cVar;
        InkSource inkSource = new InkSource();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Node item = attributes.item(i);
            inkSource.AWU.put(item.getLocalName(), item.getNodeValue());
        }
        NodeList elementsByTagNameNS = element.getElementsByTagNameNS(element.getNamespaceURI(), "traceFormat");
        if (elementsByTagNameNS.getLength() != 0) {
            inkSource.AWW = f((Element) elementsByTagNameNS.item(0), zif);
        }
        NodeList elementsByTagNameNS2 = element.getElementsByTagNameNS(element.getNamespaceURI(), "sampleRate");
        if (elementsByTagNameNS2.getLength() != 0) {
            Element element2 = (Element) elementsByTagNameNS2.item(0);
            String attribute = element2.getAttribute("uniform");
            String attribute2 = element2.getAttribute(FirebaseAnalytics.Param.VALUE);
            if ("".equals(attribute)) {
                inkSource.getClass();
                cVar = new InkSource.c(new Double(attribute2).doubleValue());
            } else {
                inkSource.getClass();
                cVar = new InkSource.c(new Double(attribute2).doubleValue(), new Boolean(attribute).booleanValue());
            }
            inkSource.AXW = cVar;
        }
        NodeList elementsByTagNameNS3 = element.getElementsByTagNameNS(element.getNamespaceURI(), "latency");
        if (elementsByTagNameNS3.getLength() != 0) {
            String attribute3 = ((Element) elementsByTagNameNS3.item(0)).getAttribute(FirebaseAnalytics.Param.VALUE);
            if ("".equals(attribute3)) {
                inkSource.getClass();
                bVar = new InkSource.b(new Double(attribute3).doubleValue());
            } else {
                bVar = null;
            }
            inkSource.AYa = bVar;
        }
        NodeList elementsByTagNameNS4 = element.getElementsByTagNameNS(element.getNamespaceURI(), "activeArea");
        if (elementsByTagNameNS4.getLength() != 0) {
            inkSource.AXX = a((Element) elementsByTagNameNS4.item(0), inkSource);
        }
        NodeList elementsByTagNameNS5 = element.getElementsByTagNameNS(element.getNamespaceURI(), "srcProperty");
        for (int i2 = 0; i2 < elementsByTagNameNS5.getLength(); i2++) {
            Element element3 = (Element) elementsByTagNameNS5.item(i2);
            String attribute4 = element3.getAttribute("name");
            String attribute5 = element3.getAttribute(FirebaseAnalytics.Param.VALUE);
            String attribute6 = element3.getAttribute("units");
            if ("".equals(attribute6)) {
                inkSource.getClass();
                dVar = new InkSource.d(inkSource, attribute4, new Double(attribute5).doubleValue());
            } else {
                inkSource.getClass();
                dVar = new InkSource.d(attribute4, new Double(attribute5).doubleValue(), attribute6);
            }
            if (inkSource.AXY == null) {
                inkSource.AXY = new ArrayList<>();
            }
            inkSource.AXY.add(dVar);
        }
        NodeList elementsByTagNameNS6 = element.getElementsByTagNameNS(element.getNamespaceURI(), "channelProperties");
        if (elementsByTagNameNS6.getLength() != 0) {
            inkSource.AXZ = f((Element) elementsByTagNameNS6.item(0));
        }
        return inkSource;
    }

    private ziq d(Element element) throws zik {
        ziq ziq = new ziq();
        String attribute = element.getAttribute(VastExtensionXmlManager.TYPE);
        if ("".equals(attribute)) {
            attribute = EnvironmentCompat.MEDIA_UNKNOWN;
        }
        new StringBuilder("mapping type=").append(attribute);
        if ("identity".equalsIgnoreCase(attribute) || EnvironmentCompat.MEDIA_UNKNOWN.equalsIgnoreCase(attribute)) {
            ziq.setType(attribute);
            String h = h(element);
            if (!h.equals("")) {
                ziq.id = h;
            }
            return ziq;
        }
        throw new zik("Feature not implemented: 'Mapping' with 'type' attribute other than identity and unknown");
    }

    private CanvasTransform e(Element element) throws zik {
        zhy zhy = new zhy();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Node item = attributes.item(i);
            zhy.setAttribute(item.getLocalName(), item.getNodeValue());
        }
        NodeList elementsByTagNameNS = element.getElementsByTagNameNS(element.getNamespaceURI(), "mapping");
        int length2 = elementsByTagNameNS.getLength();
        if (length2 == 2) {
            zhy.a(d((Element) elementsByTagNameNS.item(0)));
            zhy.b(d((Element) elementsByTagNameNS.item(1)));
        } else if (length2 == 1) {
            zhy.a(d((Element) elementsByTagNameNS.item(0)));
        }
        return zhy;
    }

    private zic e(Element element, zif zif) throws zik {
        zic zic = new zic();
        NamedNodeMap attributes = element.getAttributes();
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            Node item = attributes.item(i);
            zic.AWU.put(item.getLocalName(), item.getNodeValue());
        }
        NodeList childNodes = element.getChildNodes();
        for (int i2 = 0; i2 < childNodes.getLength(); i2++) {
            Node item2 = childNodes.item(i2);
            if (item2 instanceof Element) {
                Element element2 = (Element) item2;
                String localName = element2.getLocalName();
                if (localName.equals("brush")) {
                    zic.a(g(element2));
                } else if (localName.equals("traceFormat")) {
                    zic.a(f(element2, zif));
                } else if (localName.equals("canvas")) {
                    zic.a(c(element2, zif));
                } else if (localName.equals("canvasTransform")) {
                    zic.a(e(element2));
                } else if (localName.equals("inkSource")) {
                    zic.a((zid) d(element2, zif));
                } else if (localName.equals("timeStamp")) {
                    zic.a(gMI());
                }
            }
        }
        return zic;
    }

    private TraceFormat f(Element element, zif zif) throws zik {
        TraceFormat traceFormat = new TraceFormat();
        if (!"".equals(h(element))) {
            traceFormat.id = h(element);
            zif.b(traceFormat);
        }
        String attribute = element.getAttribute("href");
        if (!"".equals(attribute)) {
            TraceFormat aeK = zif.aeK(attribute);
            traceFormat.AYO = attribute;
            Iterator<zhz> it = aeK.gNe().iterator();
            while (it.hasNext()) {
                traceFormat.a(it.next());
            }
        }
        NodeList elementsByTagNameNS = element.getElementsByTagNameNS(element.getNamespaceURI(), AppsFlyerProperties.CHANNEL);
        int length = elementsByTagNameNS.getLength();
        for (int i = 0; i < length; i++) {
            Element element2 = (Element) elementsByTagNameNS.item(i);
            String attribute2 = element2.getAttribute("name");
            if ("".equals(attribute2)) {
                throw new zik("Channel element must have value for 'name' attribute");
            }
            zhz zhz = new zhz(attribute2);
            if ("intermittentChannels".equalsIgnoreCase(element2.getParentNode().getLocalName())) {
                zhz.AXa = true;
            }
            NamedNodeMap attributes = element2.getAttributes();
            int length2 = attributes.getLength();
            for (int i2 = 0; i2 < length2; i2++) {
                Node item = attributes.item(i2);
                zhz.setAttribute(item.getLocalName(), item.getNodeValue());
            }
            traceFormat.a(zhz);
        }
        return traceFormat;
    }

    private zia f(Element element) throws zik {
        zib zib;
        NodeList elementsByTagNameNS = element.getElementsByTagNameNS(element.getNamespaceURI(), "channelProperty");
        int length = elementsByTagNameNS.getLength();
        if (length == 0) {
            return null;
        }
        zia zia = new zia();
        for (int i = 0; i < length; i++) {
            Element element2 = (Element) elementsByTagNameNS.item(i);
            String attribute = element2.getAttribute(AppsFlyerProperties.CHANNEL);
            String attribute2 = element2.getAttribute("name");
            String attribute3 = element2.getAttribute(FirebaseAnalytics.Param.VALUE);
            String attribute4 = element2.getAttribute("units");
            String str = attribute3.equals("INF") ? "Infinity" : attribute3;
            if ("".equals(attribute4)) {
                zib = new zib(attribute, attribute2, new Double(str).doubleValue());
            } else {
                if ((attribute.equals("X") || attribute.equals("Y")) && attribute4.equals("cm")) {
                    attribute4 = "1/cm";
                }
                zib = new zib(attribute, attribute2, new Double(str).doubleValue(), attribute4);
            }
            zia.a(zib);
        }
        return zia;
    }

    private IBrush g(Element element) throws zik {
        zhw zhw = new zhw(h(element));
        String attribute = element.getAttribute("brushRef");
        if (!"".equals(attribute)) {
            zhw.AWM = attribute;
        }
        NodeList childNodes = element.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item instanceof Element) {
                Element element2 = (Element) item;
                String localName = element2.getLocalName();
                if ("annotationXML".equalsIgnoreCase(localName)) {
                    zhw.AWN = a(element2);
                } else if ("annotation".equalsIgnoreCase(localName)) {
                    zhw.AWO = b(element2);
                } else if (!"brushProperty".equalsIgnoreCase(localName)) {
                    continue;
                } else if (!element2.hasAttribute("name") || !element2.hasAttribute(FirebaseAnalytics.Param.VALUE)) {
                    throw new zik("Brush property requires name and value attributes");
                } else {
                    zhx zhx = new zhx(element2.getAttribute("name"), element2.getAttribute(FirebaseAnalytics.Param.VALUE));
                    if (element2.hasAttribute("units")) {
                        zhx.AWQ = element2.getAttribute("units");
                    }
                    zhw.bp(zhx.name, zhx.value, zhx.AWQ);
                }
            }
        }
        return zhw;
    }

    private static Timestamp gMI() throws zik {
        throw new zik("Feature not implemented. Mapping of type other than identity or unknown");
    }

    private static String h(Element element) {
        return element.hasAttributeNS("http://www.w3.org/XML/1998/namespace", "id") ? element.getAttributeNS("http://www.w3.org/XML/1998/namespace", "id") : element.hasAttribute("xml:id") ? element.getAttribute("xml:id") : element.getAttribute("id");
    }

    @Override // defpackage.zim
    public final void aeL(String str) throws zik {
        int i = 0;
        this.AXI = aeM(str);
        this.AXJ.khB = new zig();
        zig zig = this.AXJ.khB;
        if (this.AXI != null) {
            Element documentElement = this.AXI.getDocumentElement();
            if ("ink".equalsIgnoreCase(documentElement.getLocalName())) {
                zig.AXu = documentElement.getAttribute("documentID");
                NodeList childNodes = documentElement.getChildNodes();
                while (i < childNodes.getLength()) {
                    Node item = childNodes.item(i);
                    if (item instanceof Element) {
                        a((Element) item, zig);
                    }
                    i++;
                }
            } else if ("inkMLFragment".equalsIgnoreCase(documentElement.getLocalName())) {
                NodeList childNodes2 = documentElement.getChildNodes();
                while (i < childNodes2.getLength()) {
                    Node item2 = childNodes2.item(i);
                    if (item2 instanceof Element) {
                        a((Element) item2, zig);
                    }
                    i++;
                }
            }
        }
    }

    @Override // org.xml.sax.ErrorHandler
    public final void error(SAXParseException sAXParseException) throws SAXException {
        a("Error", sAXParseException);
        System.exit(-1);
    }

    @Override // org.xml.sax.ErrorHandler
    public final void fatalError(SAXParseException sAXParseException) throws SAXException {
        a("FatalError", sAXParseException);
        System.exit(-1);
    }

    @Override // org.xml.sax.ErrorHandler
    public final void warning(SAXParseException sAXParseException) throws SAXException {
        a("Warning", sAXParseException);
    }
}